//
//  ViewController.m
//  LevelDBDemo
//
//  Created by evan on 15/4/21.
//  Copyright (c) 2015年 evan. All rights reserved.
//

#import "ViewController.h"
#import "LevelDB.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(20, 50, 280, 50)];
    [button setTitle:@"创建数据库" forState:UIControlStateNormal];
    [button setBackgroundColor:[UIColor lightGrayColor]];
    [button addTarget:self action:@selector(touch) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)touch
{
    NSString *dbFile = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
    dbFile = [dbFile stringByAppendingPathComponent:@"LevelDB.db"];

    NSError *error;
    LevelDB *db = [LevelDB levelDBWithPath:dbFile error:&error];
    NSLog(@"error ==  %@",error);
}

@end
